#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int dp[302][5003];
int change(int amount, vector<int>& coins) {
    sort(coins.begin(), coins.end());
    reverse(coins.begin(), coins.end());
    for (int j = 0; j <= amount; j++) {
        if (j % coins[0] == 0) dp[0][j] = 1;
    }

    for (int i = 1; i < coins.size(); i++) {
        for (int j = 0; j <= amount; j++) {
            if (j >= coins[i]) dp[i][j] = dp[i - 1][j] + dp[i][j - coins[i]];
            else dp[i][j] = dp[i-1][j];
        }
    }
    return dp[coins.size() - 1][amount];
}

int main() {
    int amount = 5;
    vector<int> coins{1, 2, 5};
    int ans = change(amount, coins);
    cout << ans << endl;
    return 0;
}